package com.jiazhong.shixi.diancan_xitong.mapper;

import com.jiazhong.shixi.diancan_xitong.bean.Shopping_cart;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface Shopping_cartMapper {

    @Select("select * from shopping_cart where cus_id=#{cus_id}")
    List<Shopping_cart> findById(Integer Id);

    @Insert("insert into shopping_cart values (null,#{cus_id},1,#{price},#{dish_name},0)")
    void add(Shopping_cart sc);

    @Update("update shopping_cart set number=number+#{number} where cus_id=#{cus_id}")
    void update(Shopping_cart sc);

    @Update("update shopping_cart set is_deleter=1 where cus_id=#{cus_id} and dish_name=#{dish_name}")
    void remove1(Shopping_cart sc);

    @Update("update shopping_cart set is_deleter=1 where cus_id=#{cus_id}")
    void remove2(Shopping_cart sc);

}
